-- extract method for miniz
-- The MIT License (MIT)
-- Copyright (c) 2016 Yanghe Sun

miniz = require("miniz")
path  = require("path")
fs    = require("path.fs")

extract_all= (src, dest) ->
    ar = miniz.zip_read_file(src)
    for i = 1, #ar
        if not ar\is_file_a_directory(i) then
            f = io.open(path.join(dest, ar[i]), "wb")
            f\write(ar\extract(i))
            f\close()
        else
            fs.makedirs(path.join(dest, ar[i]))


miniz.extract_all = extract_all
